#include <stdlib.h>

#include "BPNet.h"

#define NUM_OF_SAMPLE 4

int main()
{
    ann::BPNet  net;
    
    net.Init();

    ann::TrainData td[NUM_OF_SAMPLE];
    td[0]._s_inData.push_back(0);
    td[0]._s_inData.push_back(0);
    td[0]._s_result.push_back(0);
    td[1]._s_inData.push_back(0);
    td[1]._s_inData.push_back(1);
    td[1]._s_result.push_back(1);
    td[2]._s_inData.push_back(1);
    td[2]._s_inData.push_back(0);
    td[2]._s_result.push_back(1);
    td[3]._s_inData.push_back(1);
    td[3]._s_inData.push_back(1);
    td[3]._s_result.push_back(0);

    for( unsigned int i = 0; i < NUM_OF_SAMPLE; ++i )
    {
        net.PushTrainData( td[i] );
    }

    net.Train();

    double ret[NUM_OF_SAMPLE];
    for ( unsigned int i = 0; i < NUM_OF_SAMPLE; ++i )
    {
        if ( net.InputData(td[i]._s_inData) )
        {
            net.Tick();
            ret[i] = net.GetResult()[0];
        }
        else
        {
            ret[i] = -1.00;
        }
    }

    printf("Get result vector (%f, %f, %f, %f)\n", ret[0], ret[1], ret[2], ret[3]);

    system("pause");

	return 0;
}
